import { BaseWindow } from "../../../component/window/BaseWindow";
import { IEquipModuleBase } from "../../../../modules/interfaces/IEquipModuleBase";
import { EquipmentModuleConst } from "./data/EquipmentModuleConst";
import { GModuleEvent } from "../../mvc/GModuleEvent";
import { EItemUpdateOper } from "../../../../Message/Game/EItemUpdateOper";
import { SPlayerItem } from "../../../../Message/Public/SPlayerItem";
import { ItemData } from "../../resource/info/ItemData";
import { DataEvent } from "../../events/DataEvent";
import { ECategory } from "../../../../Message/Public/ECategory";
import { DataProvider } from "../../../../fl/data/DataProvider";
import { EquipAdvancePanel } from "./deploy/panel/EquipAdvancePanel";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { Language } from "../../../../extend/language/Language";
import { MaterialItemData } from "./MaterialItemData";
import { EquipDecomposePanel } from "./deploy/panel/EquipDecomposePanel";
import { Cache } from "../../cache/Cache";
import { DragEvent } from "../../../../com/mui/events/DragEvent";
import { BaseItem } from "../common/BaseItem";
import { MuiEvent } from "../../../../com/mui/events/MuiEvent";
import { GuideTipsManager } from "../../manager/GuideTipsManager";
import { PetEquipGuideWindow } from "../petEquipment/PetEquipGuideWindow";
import { ImagesConst } from "../../resource/ImagesConst";
import { MsgManager } from "../../manager/MsgManager";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { EventName } from "../../mvc/EventName";
import { BaseDeployPanel } from "./deploy/panel/BaseDeployPanel";
import { GTabBar } from "../../../../com/mui/controls/GTabBar";
import { FilterConst } from "../../../component/gconst/FilterConst";
import { ModuleBg } from "../common/ModuleBg";
import { GImageBitmap } from "../../../../com/mui/controls/GImageBitmap";
import { ResouceConst } from "../../../component/gconst/ResouceConst";
import { ObjCreate } from "../common/ObjCreate";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { GTextFormat } from "../../../common/GTextFormat";
import { TilePanel } from "./TilePanel";
import { StoneItem } from "./StoneItem";
import { JewelClassComboxs } from "./JewelClassComboxs";
import { PageSelecter } from "../common/pageSelect/PageSelecter";
import { MaterialItemCellRenderer } from "./MaterialItemCellRenderer";
import { MaterialJewelCellRenderer } from "./MaterialJewelCellRenderer";
import { BuildDescription } from "./BuildDescription";
import { GScrollPane } from "../../../../com/mui/controls/GScrollPane";
import { ScrollPolicy } from "../../../../fl/controls/ScrollPolicy";
import { EquipmentMoneySprite } from "./EquipmentMoneySprite";
import { BatchRecastWindow } from "./popupPanels/BatchRecastWindow";
import { ExAttributePanel } from "./deploy/ExAttributePanel";
import { TweenLite } from "../../../../com/greensock/TweenLite";
import { RecastPanel } from "./deploy/panel/RecastPanel";
import { GLabel } from "../../../../com/mui/controls/GLabel";
import { GCheckBox } from "../../../../com/mui/controls/GCheckBox";
import { EquipmentType_All } from "../../../../EquipmentModuleConst/EquipmentType_All";
import { EquipmentType_Blue } from "../../../../EquipmentModuleConst/EquipmentType_Blue";
import { EquipmentType_Purple } from "../../../../EquipmentModuleConst/EquipmentType_Purple";
import { EquipmentType_Orange } from "../../../../EquipmentModuleConst/EquipmentType_Orange";
import { EquipmentType_Stone } from "../../../../EquipmentModuleConst/EquipmentType_Stone";
import { EquipmentType_Red } from "../../../../EquipmentModuleConst/EquipmentType_Red";
import { EquipmentType_RedGold } from "../../../../EquipmentModuleConst/EquipmentType_RedGold";
import { EquipmentType_Equip } from "../../../../EquipmentModuleConst/EquipmentType_Equip";
import { EquipmentType_Wing } from "../../../../EquipmentModuleConst/EquipmentType_Wing";
import { EquipmentType_Mount } from "../../../../EquipmentModuleConst/EquipmentType_Mount";
import { EquipmentType_RefreshProp } from "../../../../EquipmentModuleConst/EquipmentType_RefreshProp";
import { EquipmentType_Green } from "../../../../EquipmentModuleConst/EquipmentType_Green";
import { EquipmentType_EmbedJewel } from "../../../../EquipmentModuleConst/EquipmentType_EmbedJewel";
import { EquipmentType_Level40 } from "../../../../EquipmentModuleConst/EquipmentType_Level40";
import { EquipmentType_Level50 } from "../../../../EquipmentModuleConst/EquipmentType_Level50";
import { EquipmentType_Level60 } from "../../../../EquipmentModuleConst/EquipmentType_Level60";
import { EquipmentType_Level70 } from "../../../../EquipmentModuleConst/EquipmentType_Level70";
import { MaterialType_Use } from "../../../../EquipmentModuleConst/MaterialType_Use";
import { MaterialType_Jewel } from "../../../../EquipmentModuleConst/MaterialType_Jewel";
import { EquipmentType_PetEquip } from "../../../../EquipmentModuleConst/EquipmentType_PetEquip";
type int = number;
//class EquipmentModuleBase
    
    export  class EquipmentModuleBase extends BaseWindow implements IEquipModuleBase
    {
        constructor()
        {
            super();
            setSize(630, 470);
            this.addEventListener(EquipmentModuleConst.Event_DoUpdateEvent1, this.onStartUpdate);
            this.addEventListener(GModuleEvent.Event_OpenBatchRecastWin, this.onOpenBatchRecastWindow);
            this.addEventListener(GModuleEvent.Event_UpdateBatchRecastEquip, this.onUpdateBatchRecastEquip);
            return;
        }

        /* internal  */isContains(arg1: int): Boolean
        {
            var loc1=this.opertionTabBar.dataProvider;
            var loc2=0;
            while (loc2 < loc1.length) 
            {
                if (loc1[loc2]["type"] == arg1) 
                {
                    return true;
                }
                ++loc2;
            }
            return false;
        }

        protected onUpdateResult(arg1: Object): void
        {
            var loc1=null;
            if (this.isContains(arg1.operation)) 
            {
                this.currentDepolyPanel.onUpdateResult(arg1.resultId, arg1.autoUpdate, arg1.resultPlayerItem, arg1.itemUpdateResults);
            }
            if (arg1.operation == EItemUpdateOper._EItemUpdateOperRecast || arg1.operation == EItemUpdateOper._EItemUpdatePetEquipRefresh) 
            {
                if (this._batchRecastWin && !this._batchRecastWin.isHide) 
                {
                    loc1 = arg1.resultPlayerItem as SPlayerItem;
                    this._batchRecastWin.setEquip(new ItemData(loc1));
                    this._batchRecastWin.updateMaterialAmount();
                }
            }
            return;
        }

        /* internal  */onStartUpdate(arg1: DataEvent): void
        {
            return;
        }

        /* internal  */updateEquipment(arg1: Array<any>): void
        {
            var loc5=0;
            var loc6=0;
            var loc7=null;
            var loc8=null;
            var loc9=0;
            var loc1=this.opertionTabBar.dataProvider[this.opertionTabBar.selectedIndex].type;
            if (loc1 == EItemUpdateOper._EItemUpdateComposeJewel || loc1 == EItemUpdateOper._EItemUpdateJewelAddance) 
            {
                loc5 = this.equipAreaJewelCb.jewelLevel;
                loc6 = this.equipAreaJewelCb.jewelType;
                loc9 = (arg1.length - 1);
                while (loc9 >= 0) 
                {
                    loc8 = (loc7 = arg1[loc9])["data"];
                    if (!(loc5 == -1) && loc8 && loc8.category == ECategory._ECategoryJewel && !(loc8.itemInfo.item.itemLevel == loc5)) 
                    {
                        arg1.splice(loc9, 1);
                    }
                    else if (!(loc6 == -1) && loc8 && loc8.category == ECategory._ECategoryJewel && !(loc8.type == loc6)) 
                    {
                        arg1.splice(loc9, 1);
                    }
                    --loc9;
                }
            }
            this._equipmentPageSelecter.maxPage = Math.ceil(arg1.length / this._equipmentPageSize);
            if (this._equipmentPageSelecter.currentPage > this._equipmentPageSelecter.maxPage) 
            {
                this._equipmentPageSelecter.currentPage = this._equipmentPageSelecter.maxPage;
            }
            var loc2=(this._equipmentPageSelecter.currentPage - 1) * this._equipmentPageSize;
            var loc3=arg1.length < this._equipmentPageSelecter.currentPage * this._equipmentPageSize ? arg1.length : this._equipmentPageSelecter.currentPage * this._equipmentPageSize;
            var loc4=arg1.slice(loc2, loc3);
            this.panel_equipment.dataProvider = new DataProvider(loc4);
            if (loc4.length == 0 && this.currentDepolyPanel is EquipAdvancePanel) 
            {
                this._equipHintLabel.htmlText = HTMLUtil.addColor(Language.getString(60327), "#FFFF00");
            }
            else 
            {
                this._equipHintLabel.htmlText = "";
            }
            return;
        }

        /* internal  */updateMaterial(arg1: Array<any>): void
        {
            var loc1=0;
            var loc5=0;
            var loc6=0;
            var loc7=null;
            var loc8=null;
            var loc9=0;
            if (arg1.length > 0) 
            {
                if (this.materialTabBar.selectedIndex == EquipmentModuleConst.MaterialType_Jewel && arg1[0] is MaterialItemData) 
                {
                    return;
                }
                if (this.materialTabBar.selectedIndex == EquipmentModuleConst.MaterialType_Use && !(arg1[0] is MaterialItemData)) 
                {
                    return;
                }
            }
            if (this.materialTabBar.selectedIndex == EquipmentModuleConst.MaterialType_Jewel) 
            {
                loc5 = this.materialAreaJewelCb.jewelLevel;
                loc6 = this.materialAreaJewelCb.jewelType;
                loc9 = (arg1.length - 1);
                while (loc9 >= 0) 
                {
                    loc8 = (loc7 = arg1[loc9])["data"];
                    if (!(loc5 == -1) && loc8 && loc8.category == ECategory._ECategoryJewel && !(loc8.itemInfo.item.itemLevel == loc5)) 
                    {
                        arg1.splice(loc9, 1);
                    }
                    else if (!(loc6 == -1) && loc8 && loc8.category == ECategory._ECategoryJewel && !(loc8.type == loc6)) 
                    {
                        arg1.splice(loc9, 1);
                    }
                    --loc9;
                }
            }
            if (this.materialTabBar.selectedIndex != EquipmentModuleConst.MaterialType_Use) 
            {
                if (this.materialTabBar.selectedIndex == EquipmentModuleConst.MaterialType_Jewel) 
                {
                    loc1 = this._materialJewelPageSize;
                }
            }
            else 
            {
                loc1 = this._materialPageSize;
            }
            this._materialPageSelecter.maxPage = Math.ceil(arg1.length / loc1);
            if (this._materialPageSelecter.currentPage > this._materialPageSelecter.maxPage) 
            {
                this._materialPageSelecter.currentPage = this._materialPageSelecter.maxPage;
            }
            var loc2=(this._materialPageSelecter.currentPage - 1) * loc1;
            var loc3=arg1.length < this._materialPageSelecter.currentPage * loc1 ? arg1.length : this._materialPageSelecter.currentPage * loc1;
            var loc4=arg1.slice(loc2, loc3);
            if (this.materialTabBar.selectedIndex != EquipmentModuleConst.MaterialType_Use) 
            {
                if (this.materialTabBar.selectedIndex == EquipmentModuleConst.MaterialType_Jewel) 
                {
                    this.panel_jewel.dataProvider = new DataProvider(loc4);
                }
            }
            else 
            {
                this.panel_material.dataProvider = new DataProvider(loc4);
            }
            return;
        }

        /* internal  */setAutoChooseLuckTune(arg1: Object): void
        {
            this.currentDepolyPanel.setAutoChooseLuckTune(arg1);
            return;
        }

        /* internal  */setAutoChooseMaterial(arg1: Object): void
        {
            this.currentDepolyPanel.setAutoChooseMaterial(arg1);
            return;
        }

        /* internal  */equipmentLost(arg1: Array<any>=null): void
        {
            if (typeof this.currentDepolyPanel === "equipdecomposepanel") 
            {
                (this.currentDepolyPanel as EquipDecomposePanel).doEquipmentLost(arg1);
            }
            else 
            {
                this.currentDepolyPanel.clear();
            }
            return;
        }

        protected getOperIndexByType(arg1: int): int
        {
            var loc1=this.opertionTabBar.dataProvider;
            var loc2=0;
            while (loc2 < loc1.length) 
            {
                if (loc1[loc2]["type"] == arg1) 
                {
                    return loc2;
                }
                ++loc2;
            }
            return 0;
        }

        public setMaterialTabBarIndex(arg1: int): void
        {
            if (this.materialTabBar.selectedIndex != arg1) 
            {
                this.materialTabBar.selectedIndex = arg1;
                this.materialChangeHandler();
            }
            return;
        }

        protected showToPanel(arg1: int): void
        {
            var loc1=this.getOperIndexByType(arg1);
            if (this.opertionTabBar.selectedIndex != loc1) 
            {
                this.opertionTabBar.selectedIndex = loc1;
                this.opertionChangeHandler();
            }
            return;
        }

        public /* override */ update(arg1: Object, ... rest): void
        {
            if (!this._cache) 
            {
                this._cache = arg1.data as Cache;
            }
            var loc1=arg1.type;
            switch (loc1) 
            {
                case "updateCost":
                {
                    this._moneySprite.updateMoney(arg1.data.gold, arg1.data.coin, arg1.data.coinBind);
                    this.updateCost(arg1.data);
                    break;
                }
                case "updateResut":
                {
                    this.onUpdateResult(arg1);
                    break;
                }
                case "updateError":
                {
                    this.onUpdateError();
                    break;
                }
                case "updateEquipment":
                {
                    this.updateEquipment(arg1.data as Array<any>);
                    break;
                }
                case "updateMaterial":
                {
                    this.updateMaterial(arg1.data as Array<any>);
                    break;
                }
                case "autoChooseMaterial":
                {
                    this.setAutoChooseMaterial(arg1);
                    break;
                }
                case "autoChooseLuckTune":
                {
                    this.setAutoChooseLuckTune(arg1);
                    break;
                }
                case "equipmentLost":
                {
                    this.equipmentLost(arg1.data as Array<any>);
                    break;
                }
                case "showToPanel":
                {
                    this.showToPanel(Number(arg1.data));
                    break;
                }
                case "doCast":
                {
                    this.currentDepolyPanel.putInItem(arg1.data as ItemData);
                    break;
                }
                case "setAutoBuy":
                {
                    this._autoBuy.selected = arg1.data;
                    break;
                }
                case "setBuyDirect":
                {
                    this._buyDirect.selected = !arg1.data;
                    break;
                }
            }
            return;
        }

        /* internal  */moveInHandler(arg1: DragEvent): void
        {
            var loc1=arg1.dragItem as BaseItem;
            var loc2=arg1.dropItem as BaseItem;
            this.currentDepolyPanel.putInItem(loc1.itemData);
            return;
        }

        /* internal  */materialChangeHandler(arg1: MuiEvent=null): void
        {
            if (this.materialTabBar.selectedIndex != EquipmentModuleConst.MaterialType_Use) 
            {
                this.panel_material.visible = false;
                this.panel_jewel.visible = true;
                this.bodySprite.addChild(this.materialAreaJewelCb);
            }
            else 
            {
                this.panel_material.visible = true;
                this.panel_material.selectedItem = null;
                this.panel_jewel.visible = false;
                if (this.materialAreaJewelCb.parent) 
                {
                    this.materialAreaJewelCb.parent.removeChild(this.materialAreaJewelCb);
                }
            }
            this.dispatchEvent(new DataEvent(EquipmentModuleConst.Event_MaterialTypeChange, this.materialTabBar.selectedIndex));
            return;
        }

        /* internal  */updateMaterialArea(arg1: int): void
        {
            if (arg1 == EItemUpdateOper._EItemUpdateOperEmbedJewel || arg1 == EItemUpdateOper._EItemUpdateOperRemoveJewel) 
            {
                this.materialTabBar.visible = true;
                this._materialLabel.visible = false;
                this.materialTabBar.selectedIndex = 1;
            }
            else 
            {
                this.materialTabBar.visible = false;
                this._materialLabel.visible = true;
                this.materialTabBar.selectedIndex = 0;
            }
            this.materialChangeHandler();
            return;
        }

        /* internal  */equipmentChange(): void
        {
            this.dispatchEvent(new DataEvent(EquipmentModuleConst.Event_EquipmentTypeChange, this.equipmentTabBar.dataProvider[this.equipmentTabBar.selectedIndex].type));
            if (Cache.instance.guide.guideFirstPurplePetEquipmentStep == 2 && this.equipmentTabBar.dataProvider[this.equipmentTabBar.selectedIndex].type == EquipmentModuleConst.EquipmentType_PetEquip) 
            {
                Cache.instance.guide.guideFirstPurplePetEquipmentStep = 3;
                GuideTipsManager.hideGuideTips();
                PetEquipGuideWindow.instance.updateDisplayListByType();
                PetEquipGuideWindow.instance.loadBG(ImagesConst.GuidePetInlayJewel);
            }
            return;
        }

        /* internal  */equipmentChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            this.equipmentChange();
            return;
        }

        /* internal  */useBindChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            dispatchEvent(new DataEvent(EquipmentModuleConst.Event_UseBindChange, this.useBindMaterial.selected));
            if (this._batchRecastWin && !this._batchRecastWin.isHide) 
            {
                this._batchRecastWin.updateMaterialAmount();
            }
            return;
        }

        protected onItemClick(arg1: Object /* flash.events.Event */): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=arg1.currentTarget;
            switch (loc3) 
            {
                case this.panel_equipment: case this.panel_jewel:
                {
                    loc1 = arg1.currentTarget.selectedItem;
                    if (loc1) 
                    {
                        this.currentDepolyPanel.putInItem(loc1.data, false, loc1.equip);
                        arg1.target.selectedItem = null;
                    }
                    break;
                }
                case this.panel_material:
                {
                    if (this.opertionTabBar.dataProvider[this.opertionTabBar.selectedIndex].type == EItemUpdateOper._EItemUpdateComposeJewel) 
                    {
                        loc2 = arg1.currentTarget.selectedItem;
                        if (loc2) 
                        {
                            if (loc2.itemData.itemAmount > 0) 
                            {
                                this.currentDepolyPanel.putInItem(loc2.itemData);
                            }
                            else 
                            {
                                MsgManager.showRollTipsMsg(Language.getString(60328));
                            }
                            arg1.target.selectedItem = null;
                        }
                    }
                    break;
                }
            }
            Cache.instance.equipment.isCurRecastNoTips = false;
            return;
        }

        /* internal  */onAutoBuyChange(arg1: Object /* flash.events.Event */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.Equipment_OnAutoBuyChange, this._autoBuy.selected));
            return;
        }

        /* internal  */onBuyDirectChange(arg1: Object /* flash.events.Event */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.Equipment_OnBuyDirectChange, !this._buyDirect.selected));
            return;
        }

        /* internal  */onMaterialPageChange(arg1: Object /* flash.events.Event */): void
        {
            this.dispatchEvent(new DataEvent(EquipmentModuleConst.Event_MaterialTypeChange, this.materialTabBar.selectedIndex));
            return;
        }

        /* internal  */onEquipmentPageChange(arg1: Object /* flash.events.Event */): void
        {
            this.equipmentChange();
            return;
        }

        public allPanels(arg1: int): BaseDeployPanel
        {
            return null;
        }

        public get operationType(): int
        {
            return this.opertionTabBar.dataProvider[this.opertionTabBar.selectedIndex].type;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            this.opertionTabBar = new GTabBar();
            this.opertionTabBar.x = 13;
            this.opertionTabBar.y = 34;
            this.opertionTabBar.buttonWidth = 62;
            this.opertionTabBar.horizontalGap = 1;
            this.opertionTabBar.buttonFilters = [FilterConst.glowFilter];
            this.opertionTabBar.addEventListener(MuiEvent.GTABBAR_SELECTED_CHANGE, this.opertionChangeHandler);
            this.addChild(this.opertionTabBar);
            this.bodySprite = new Object /* flash.display.Sprite */();
            this.addChild(this.bodySprite);
            var loc1=new ModuleBg();
            this.bodySprite.addChild(loc1);
            loc1.addItem(new GImageBitmap("equipment_update_bg"), {"x": 16, "y": 58});
            loc1.addItem(ResouceConst.getScaleBitmap(ImagesConst.WindowCenterB), {"x": 18, "y": 357, "width": 317, "height": 80});
            ObjCreate.createLabel(Language.getString(60322), 222, 336, 100, 20, flash.text.TextFormatAlign.LEFT, this.bodySprite, true, 15859633);
            loc1.addItem(GlobalClass.getScaleBitmap(ImagesConst.DisabledBg, new Object /* flash.geom.Rectangle */(4, 4, 36, 21)), {"x": 257, "y": 337, "width": 75, "height": 18});
            loc1.addItem(ResouceConst.getScaleBitmap(ImagesConst.Tongqian_small), {"x": 310, "y": 339});
            this.meneyCostLabel = ObjCreate.createLabel("0", 257, 337, 50, 20, flash.text.TextFormatAlign.LEFT, this.bodySprite, false, 15859633);
            this.useBindMaterial = ObjCreate.createCheckBox(Language.getString(60323), 18, 333, 150, 28, this.bodySprite);
            this.useBindMaterial.toolTipData = HTMLUtil.addColor(Language.getString(61083), "#FFFFFF");
            this.useBindMaterial.selected = true;
            this.useBindMaterial.addEventListener(flash.events.Event.CHANGE, this.useBindChangeHandler);
            this.equipmentTabBar = new GTabBar();
            this.equipmentTabBar.x = 340;
            this.equipmentTabBar.y = 60;
            this.equipmentTabBar.buttonHeight = 22;
            this.equipmentTabBar.buttonWidth = 50;
            this.equipmentTabBar.buttonFilters = [FilterConst.glowFilter];
            this.equipmentTabBar.dataProvider = this.equipmentPageData;
            this.equipmentTabBar.addEventListener(MuiEvent.GTABBAR_SELECTED_CHANGE, this.equipmentChangeHandler);
            this.bodySprite.addChild(this.equipmentTabBar);
            ObjCreate.createBg(339, 81, 270, 375, this.bodySprite, ImagesConst.WindowCenterB);
            ObjCreate.createBg(341, 284, 266, 2, this.bodySprite, ImagesConst.SplitLine);
            this.materialTabBar = new GTabBar();
            this.materialTabBar.x = 340;
            this.materialTabBar.y = 288;
            this.materialTabBar.buttonHeight = 22;
            this.materialTabBar.buttonWidth = 43;
            this.materialTabBar.buttonFilters = [FilterConst.glowFilter];
            this.materialTabBar.buttonStyleName = "ButtonMini";
            this.materialTabBar.dataProvider = this.useTypeData;
            this.materialTabBar.addEventListener(MuiEvent.GTABBAR_SELECTED_CHANGE, this.materialChangeHandler);
            this.materialTabBar.visible = false;
            this.bodySprite.addChild(this.materialTabBar);
            this._materialLabel = ObjCreate.createLabel(Language.getString(60324), 344, 288, 100, 20, flash.text.TextFormatAlign.LEFT, this.bodySprite, true, 11661311);
            this._autoBuy = ObjCreate.createCheckBox(Language.getString(60325), 435, 288, 100, 20, this.bodySprite, "GRadioButton");
            this._autoBuy.addEventListener(flash.events.Event.CHANGE, this.onAutoBuyChange);
            this._autoBuy.selected = Cache.instance.equipment.isAutoBuy;
            this._buyDirect = ObjCreate.createCheckBox(Language.getString(60326), 533, 288, 90, 20, this.bodySprite, "GRadioButton");
            this._buyDirect.selected = true;
            this._buyDirect.addEventListener(flash.events.Event.CHANGE, this.onBuyDirectChange);
            var loc2=new GTextFormat();
            loc2.align = flash.text.TextFormatAlign.RIGHT;
            this.meneyCostLabel.setStyle("textFormat", loc2);
            this._equipHintLabel = ObjCreate.createLabel("", 345, 90, 200, 20, flash.text.TextFormatAlign.LEFT, this.bodySprite, false, 16776960);
            this.panel_equipment = new TilePanel();
            this.panel_equipment.x = 342;
            this.panel_equipment.y = 85;
            this.panel_equipment.setSize(266, 180);
            this.panel_equipment.horizontalGap = 4;
            this.panel_equipment.verticalGap = 5;
            this.panel_equipment.setStyle("cellRenderer", StoneItem);
            this.bodySprite.addChild(this.panel_equipment);
            this.panel_equipment.addEventListener("change", this.onItemClick);
            this.equipAreaJewelCb = new JewelClassComboxs();
            this.equipAreaJewelCb.x = 343;
            this.equipAreaJewelCb.y = 262;
            this.equipAreaJewelCb.addEventListener(flash.events.Event.CHANGE, this.equipmentChangeHandler);
            this._equipmentPageSelecter = ObjCreate.createPageSelecter(476, 262, this.bodySprite);
            this._equipmentPageSelecter.mode = PageSelecter.CompleteMode;
            this._equipmentPageSelecter.addEventListener(flash.events.Event.CHANGE, this.onEquipmentPageChange);
            this.panel_material = new TilePanel();
            this.panel_material.x = 342;
            this.panel_material.y = 308;
            this.panel_material.setSize(266, 125);
            this.panel_material.rowHeight = 58;
            this.panel_material.columnWidth = 128;
            this.panel_material.horizontalGap = 4;
            this.panel_material.verticalGap = 5;
            this.panel_material.setStyle("cellRenderer", MaterialItemCellRenderer);
            this.bodySprite.addChild(this.panel_material);
            this.panel_material.addEventListener("change", this.onItemClick);
            this.panel_jewel = new TilePanel();
            this.panel_jewel.x = 348;
            this.panel_jewel.y = 312;
            this.panel_jewel.setSize(254, 120);
            this.panel_jewel.rowHeight = 38;
            this.panel_jewel.columnWidth = 38;
            this.panel_jewel.horizontalGap = 4;
            this.panel_jewel.verticalGap = 2;
            this.panel_jewel.setStyle("cellRenderer", MaterialJewelCellRenderer);
            this.panel_jewel.visible = false;
            this.bodySprite.addChild(this.panel_jewel);
            this.panel_jewel.addEventListener("change", this.onItemClick);
            this.materialAreaJewelCb = new JewelClassComboxs();
            this.materialAreaJewelCb.x = 343;
            this.materialAreaJewelCb.y = 432;
            this.materialAreaJewelCb.addEventListener(flash.events.Event.CHANGE, this.onMaterialPageChange);
            this._materialPageSelecter = ObjCreate.createPageSelecter(476, 432, this.bodySprite);
            this._materialPageSelecter.mode = PageSelecter.CompleteMode;
            this._materialPageSelecter.addEventListener(flash.events.Event.CHANGE, this.onMaterialPageChange);
            this.buildDescription = new BuildDescription();
            this.buildDescription.ChangeToItem(EItemUpdateOper._EItemUpdateOperStrengthen);
            this._descScrolPane = new GScrollPane();
            this._descScrolPane.x = 23;
            this._descScrolPane.y = 362;
            this._descScrolPane.width = 310;
            this._descScrolPane.height = 70;
            this._descScrolPane.styleName = "GScrollPane";
            this._descScrolPane.verticalScrollPolicy = ScrollPolicy.AUTO;
            this._descScrolPane.horizontalScrollPolicy = ScrollPolicy.OFF;
            this._descScrolPane.source = this.buildDescription;
            this._descScrolPane.scrollDrag = false;
            this._descScrolPane.focusEnabled = false;
            this.bodySprite.addChild(this._descScrolPane);
            this._descScrolPane.update();
            this._moneySprite = new EquipmentMoneySprite();
            this._moneySprite.x = 18;
            this._moneySprite.y = 440;
            this.bodySprite.addChild(this._moneySprite);
            this._hintLabel = ObjCreate.createLabel("", 0, 240, 354, 100, flash.text.TextFormatAlign.CENTER, this.bodySprite);
            this._hintLabel.mouseEnabled = false;
            this._hintLabel.mouseChildren = false;
            this._hintLabel.textField.filters = [FilterConst.taskShowTargetFilter];
            return;
        }

        /* internal  */get batchRecastWin(): BatchRecastWindow
        {
            if (!this._batchRecastWin) 
            {
                this._batchRecastWin = new BatchRecastWindow(this);
                this._batchRecastWin.addEventListener(ExAttributePanel.UseLockChange, this.onBatchUseLockChange);
            }
            return this._batchRecastWin;
        }

        protected opertionChangeHandler(arg1: MuiEvent=null): void
        {
            var loc1=this.opertionTabBar.dataProvider[this.opertionTabBar.selectedIndex].type;
            this.currentDepolyPanel.visible = false;
            this.currentDepolyPanel.clear();
            this.panel_equipment.selectedItem = null;
            this.panel_material.selectedItem = null;
            this.currentDepolyPanel = this.allPanels(loc1);
            this.currentDepolyPanel.visible = true;
            this.dispatchEvent(new DataEvent(EquipmentModuleConst.Event_OpertionTypeChange, loc1));
            if (loc1 == EItemUpdateOper._EItemUpdateComposeJewel || loc1 == EItemUpdateOper._EItemUpdateJewelAddance) 
            {
                this.bodySprite.addChild(this.equipAreaJewelCb);
            }
            else if (this.equipAreaJewelCb.parent) 
            {
                this.equipAreaJewelCb.parent.removeChild(this.equipAreaJewelCb);
            }
            var loc2=loc1;
            switch (loc2) 
            {
                case EItemUpdateOper._EItemUpdateComposeJewel:
                {
                    this.equipmentTabBar.dataProvider = this.equipmentPageData_onlyJewel;
                    break;
                }
                case EItemUpdateOper._EItemUpdateJewelAddance:
                {
                    this.equipmentTabBar.dataProvider = this.equipmentPageData_JewelAdvance;
                    break;
                }
                case EItemUpdateOper._EItemUpdateOperAdvance:
                {
                    this.equipmentTabBar.dataProvider = this.equipmentPageData_onlyAll;
                    break;
                }
                case EItemUpdateOper._EItemUpdateOperAdvanceColor:
                {
                    this.equipmentTabBar.dataProvider = this.equipmentPageData_equipType;
                    break;
                }
                case EItemUpdateOper._EItemUpdatePetEquipRefresh: case EItemUpdateOper._EItemUpdateOperMerge:
                {
                    this.equipmentTabBar.dataProvider = this.equipmentPageData_merge;
                    break;
                }
                case EItemUpdateOper._EItemUpdateOperEquipSmelt:
                {
                    this.equipmentTabBar.dataProvider = this.equipmentPageData_melt;
                    break;
                }
                case EItemUpdateOper._EItemUpdateOperEmbedJewel: case EItemUpdateOper._EItemUpdateOperRemoveJewel:
                {
                    this.equipmentTabBar.dataProvider = this.equipmentPageData_JewelEmbedRemove;
                    break;
                }
                case EItemUpdateOper._EItemUpdateOperPetEquipAdvance:
                {
                    this.equipmentTabBar.dataProvider = this.equipmentPageData_onlyEquiped;
                    break;
                }
                default:
                {
                    if (Cache.instance.role.entityInfo.level >= 70) 
                    {
                        this.equipmentTabBar.dataProvider = this.equipmentPageData_noJewel_Red;
                    }
                    else 
                    {
                        this.equipmentTabBar.dataProvider = this.equipmentPageData_noJewel;
                    }
                    break;
                }
            }
            this.equipmentTabBar.selectedIndex = 0;
            this.updateMaterialArea(loc1);
            this.dispatchEvent(new DataEvent(EquipmentModuleConst.Event_EquipmentTypeChange, this.equipmentTabBar.dataProvider[this.equipmentTabBar.selectedIndex].type));
            this.dispatchEvent(new DataEvent(EquipmentModuleConst.Event_ChoosedEquimentChange, [], false, true));
            this.buildDescription.ChangeToItem(this.opertionTabBar.selectedItem["type"]);
            this._descScrolPane.update();
            if (Cache.instance.guide.guidePetEquipStrenthenStep == 2 && loc1 == EItemUpdateOper._EItemUpdateOperPetEquipStrengthen) 
            {
                Cache.instance.guide.guidePetEquipStrenthenStep = 3;
                GuideTipsManager.hideGuideTips();
                PetEquipGuideWindow.instance.updateDisplayListByType();
                PetEquipGuideWindow.instance.loadBG(ImagesConst.GuidePetEquipStrenthen);
            }
            if (Cache.instance.guide.petEquipRefresh && loc1 == EItemUpdateOper._EItemUpdatePetEquipRefresh) 
            {
                PetEquipGuideWindow.instance.updateDisplayListByType();
                PetEquipGuideWindow.instance.loadBG(ImagesConst.GuidePetEquipRefresh);
            }
            return;
        }

        /* internal  */onUpdateError(): void
        {
            this.currentDepolyPanel.onUpdateStatus();
            return;
        }

        /* internal  */updateCost(arg1: Object): void
        {
            if (arg1.cost <= arg1.moneyHave) 
            {
                this.meneyCostLabel.htmlText = HTMLUtil.addColor(String(arg1.cost), "#FCFECA");
                this.currentDepolyPanel.isEnoughMoney = true;
            }
            else 
            {
                this.meneyCostLabel.htmlText = HTMLUtil.addColor(String(arg1.cost), "#FF0000");
                this.currentDepolyPanel.isEnoughMoney = false;
                MsgManager.showRollTipsMsg(Language.getString(60121));
            }
            return;
        }

        public addHintLabel(arg1: string): void
        {
            if (this._hintLabel.parent) 
            {
                this._hintLabel.parent.setChildIndex(this._hintLabel, (this._hintLabel.parent.numChildren - 1));
            }
            this._hintLabel.htmlText = arg1;
            var loc1=new GTextFormat();
            loc1.size = 50;
            loc1.align = flash.text.TextFormatAlign.CENTER;
            this._hintLabel.textField.setTextFormat(loc1);
            this._hintLabel.y = 240;
            this._hintLabel.alpha = 1;
            TweenLite.to(this._hintLabel, 2, {"y": 200, "alpha": 0});
            return;
        }

        public checkHasOperType(arg1: int): Boolean
        {
            var loc1=this.opertionTabBar.dataProvider;
            var loc2=0;
            while (loc2 < loc1.length) 
            {
                if (loc1[loc2]["type"] == arg1) 
                {
                    return true;
                }
                ++loc2;
            }
            return false;
        }

        protected onUseLockChange(arg1: DataEvent): void
        {
            var loc1=arg1.data as Map<any, any> /* flash.utils.Dictionary */;
            this.changeBatchLock(loc1);
            return;
        }

        protected onBatchUseLockChange(arg1: DataEvent): void
        {
            if (typeof this.currentDepolyPanel === "recastpanel") 
            {
                (this.currentDepolyPanel as RecastPanel).setLockPos(arg1.data as Map<any, any> /* flash.utils.Dictionary */);
            }
            return;
        }

        public changeBatchLock(arg1: Map<any, any> /* flash.utils.Dictionary */): void
        {
            if (this._batchRecastWin && !this._batchRecastWin.isHide) 
            {
                this._batchRecastWin.setLockPos(arg1);
            }
            return;
        }

        public changeRecastLock(arg1: Map<any, any> /* flash.utils.Dictionary */): void
        {
            return;
        }

        /* internal  */onOpenBatchRecastWindow(arg1: DataEvent): void
        {
            var loc1=arg1.data.equip as ItemData;
            var loc2=arg1.data.lockDic as Map<any, any> /* flash.utils.Dictionary */;
            if (loc1) 
            {
                this.batchRecastWin.show();
                this.batchRecastWin.setEquip(loc1);
                this.batchRecastWin.setLockPos(loc2);
                this.batchRecastWin.updateMoney();
                this.batchRecastWin.updateMaterialAmount();
            }
            return;
        }

        /* internal  */onUpdateBatchRecastEquip(arg1: DataEvent): void
        {
            var loc1=arg1.data as ItemData;
            if (this._batchRecastWin && !this._batchRecastWin.isHide && loc1) 
            {
                this._batchRecastWin.setEquip(loc1);
                this._batchRecastWin.updateMoney();
                this._batchRecastWin.updateMaterialAmount();
            }
            return;
        }

        public /* override */ hide(): void
        {
            if (this.currentDepolyPanel) 
            {
                this.currentDepolyPanel.hide();
            }
            Dispatcher.dispatchEvent(new DataEvent(EventName.Equipment_WindowClose));
            super.hide();
            return;
        }

        public gotoPanel(arg1: int): void
        {
            this.opertionTabBar.selectedIndex = arg1;
            this.opertionChangeHandler();
            return;
        }

        public checkGuide(): void
        {
            return;
        }

        /* internal */ /* const */equipmentPageData: Array<any>=[{"name":"", "type": EquipmentType_All, "label": Language.getString(60315)}, {"name":"", "type": EquipmentType_Blue, "label": Language.getString(60317)}, {"name":"", "type": EquipmentType_Purple, "label": Language.getString(60318)}, {"name":"", "type": EquipmentType_Orange, "label": Language.getString(60319)}, {"name":"", "type": EquipmentType_Stone, "label": Language.getString(60320)}];

        /* internal */ /* const */equipmentPageData_noJewel: Array<any>=[{"name":"", "type": EquipmentType_All, "label": Language.getString(60315)}, {"name":"", "type": EquipmentType_Blue, "label": Language.getString(60317)}, {"name":"", "type": EquipmentType_Purple, "label": Language.getString(60318)}, {"name":"", "type": EquipmentType_Orange, "label": Language.getString(60319)}];

        /* internal */ /* const */equipmentPageData_noJewel_Red: Array<any>=[{"name":"", "type": EquipmentType_All, "label": Language.getString(60315)}, {"name":"", "type": EquipmentType_Purple, "label": Language.getString(60318)}, {"name":"", "type": EquipmentType_Orange, "label": Language.getString(60319)}, {"name":"", "type": EquipmentType_Red, "label": Language.getString(61090)}, {"name":"", "type": EquipmentType_RedGold, "label": Language.getString(74014)}];

        /* internal */ /* const */equipmentPageData_onlyEquiped: Array<any>=[{"name":"", "type": EquipmentType_All, "label": Language.getString(61365)}];

        /* internal */ /* const */equipmentPageData_equipType: Array<any>=[{"name":"", "type": EquipmentType_All, "label": Language.getString(60315)}, {"name":"", "type": EquipmentType_Equip, "label": Language.getString(61091)}, {"name":"", "type": EquipmentType_Wing, "label": Language.getString(61092)}, {"name":"", "type": EquipmentType_Mount, "label": Language.getString(61093)}];

        /* internal */ /* const */equipmentPateData_refreshProp: Array<any>=[{"name":"", "type": EquipmentType_RefreshProp, "label": Language.getString(60315)}];

        /* internal */ /* const */equipmentPageData_onlyJewel: Array<any>=[{"name":"", "type": EquipmentType_Stone, "label": Language.getString(60320)}, {"name":"", "type": EquipmentType_Green, "label": Language.getString(60316)}, {"name":"", "type": EquipmentType_Blue, "label": Language.getString(60317)}, {"name":"", "type": EquipmentType_Purple, "label": Language.getString(60318)}];

        /* internal */ /* const */equipmentPageData_JewelAdvance: Array<any>=[{"name":"", "type": EquipmentType_Stone, "label": Language.getString(60320)}, {"name":"", "type": EquipmentType_Green, "label": Language.getString(60316)}, {"name":"", "type": EquipmentType_Blue, "label": Language.getString(60317)}, {"name":"", "type": EquipmentType_Purple, "label": Language.getString(60318)}, {"name":"", "type": EquipmentType_EmbedJewel, "label": Language.getString(61070)}];

        /* internal */ /* const */equipmentPageData_merge: Array<any>=[{"name":"", "type": EquipmentType_All, "label": Language.getString(60315)}, {"name":"", "type": EquipmentType_Blue, "label": Language.getString(60317)}, {"name":"", "type": EquipmentType_Purple, "label": Language.getString(60318)}, {"name":"", "type": EquipmentType_Orange, "label": Language.getString(60319)}];

        /* internal */ /* const */equipmentPageData_melt: Array<any>=[{"name":"", "type": EquipmentType_All, "label": Language.getString(60315)}, {"name":"", "type": EquipmentType_Level40, "label": Language.getStringByParam(61039, 40)}, {"name":"", "type": EquipmentType_Level50, "label": Language.getStringByParam(61039, 50)}, {"name":"", "type": EquipmentType_Level60, "label": Language.getStringByParam(61039, 60)}, {"name":"", "type": EquipmentType_Level70, "label": Language.getStringByParam(61039, 70)}];

        /* internal */ /* const */useTypeData: Array<any>=[{"name":"", "type": MaterialType_Use, "label": Language.getString(60321)}, {"name":"", "type": MaterialType_Jewel, "label": Language.getString(60320)}];

        /* internal */ /* const */equipmentPageData_JewelEmbedRemove: Array<any>=[{"name":"", "type": EquipmentType_All, "label": Language.getString(60315)}, {"name":"", "type": EquipmentType_Purple, "label": Language.getString(60318)}, {"name":"", "type": EquipmentType_Orange, "label": Language.getString(60319)}, {"name":"", "type": EquipmentType_Red, "label": Language.getString(61090)}, {"name":"", "type": EquipmentType_PetEquip, "label": Language.getString(61094)}];

        /* internal */ /* const */equipmentPageData_onlyAll: Array<any>=[{"name":"", "type": EquipmentType_All, "label": Language.getString(60315)}];

        protected /* var */meneyCostLabel: GLabel;

        protected /* var */panel_jewel: TilePanel;

        protected /* var */panel_material: TilePanel;

        protected /* var */panel_equipment: TilePanel;

        /* internal */ /* var */_buyDirect: GCheckBox;

        /* internal */ /* var */_materialLabel: GLabel;

        /* internal */ /* var */materialTabBar: GTabBar;

        protected /* var */equipmentTabBar: GTabBar;

        protected /* var */opertionTabBar: GTabBar;

        protected /* var */bodySprite: Object /* flash.display.Sprite */;

        /* internal */ /* var */_materialJewelPageSize: int=18;

        /* internal */ /* var */_materialPageSize: int=4;

        /* internal */ /* var */_equipmentPageSize: int=8;

        /* internal */ /* var */_batchRecastWin: BatchRecastWindow;

        protected /* var */_hintLabel: GLabel;

        protected /* var */materialAreaJewelCb: JewelClassComboxs;

        /* internal */ /* var */_autoBuy: GCheckBox;

        protected /* var */equipAreaJewelCb: JewelClassComboxs;

        protected /* var */_descScrolPane: GScrollPane;

        protected /* var */buildDescription: BuildDescription;

        protected /* var */currentDepolyPanel: BaseDeployPanel;

        protected /* var */useBindMaterial: GCheckBox;

        /* internal */ /* var */_materialPageSelecter: PageSelecter;

        /* internal */ /* var */_cache: Cache;

        /* internal */ /* var */_equipmentPageSelecter: PageSelecter;

        /* internal */ /* var */_moneySprite: EquipmentMoneySprite;

        /* internal */ /* var */_equipHintLabel: GLabel;
    }
